// 不同类型的装饰器的执行顺序
/**
 * 1. 属性装饰器、方法装饰器、访问器装饰器他们是按照在类中出现的顺序，从上往下依次执行
 * 2. 类装饰器最后执行
 * 3. 参数访问器先于方法访问器
 */
function classDecorator1(target) {
  console.log('classDecorator1')
}
function classDecorator2(target) {
  console.log('classDecorator2')
}
function propertyDecorator1(target, propertyKey) {
  console.log('propertyDecorator1')
}
function propertyDecorator2(target, propertyKey) {
  console.log('propertyDecorator2')
}
function methodDecorator1(target, propertyKey) {
  console.log('methodDecorator1')
}
function methodDecorator2(target, propertyKey) {
  console.log('methodDecorator2')
}
function accessDecorator1(target, propertyKey) {
  console.log('accessDecorator1')
}
function accessDecorator2(target, propertyKey) {
  console.log('accessDecorator2')
}
function parametorDecorator1(target, propertyKey, parametorIndex: number) {
  console.log('parametorDecorator1')
}
function parametorDecorator2(target, propertyKey, parametorIndex: number) {
  console.log('parametorDecorator2')
}
@classDecorator1
@classDecorator2
class Example {
  @propertyDecorator1
  @propertyDecorator2
  prop: string
  @accessDecorator1
  @accessDecorator2
  get myProp() {
    return this.prop
  }
  @methodDecorator1
  @methodDecorator2
  method(@parametorDecorator1 @parametorDecorator2 param: any) {

  }
}

/**
 * 打印结果
 *
propertyDecorator2
propertyDecorator1
accessDecorator2
accessDecorator1
parametorDecorator2
parametorDecorator1
methodDecorator2
methodDecorator1
classDecorator2
classDecorator1
 */
// 如果一个方法有多个参数，参数装饰器会从右往左执行
// 一个参数也可有多个参数装饰器，这些装饰器也是从右往左执行的